import { StyleSheet, Text, View, Image, TouchableOpacity, Alert, ToastAndroid } from 'react-native'
import React,{useState} from 'react'
import { router } from 'expo-router'

export default function SetUp() {
  const [cun, setCun] = useState(5)


  const Toex = () => {
    Alert.alert("暂无更新")
  }
  const Toex1 = () => {
    router.push("/MyViews/GaiZhang")
  }
  const Toex2 = () => {
    router.push("/MyViews/Changepassword")
  }
  const Toecleax = () => {
    ToastAndroid.showWithGravity(
      '清理缓存成功',
      ToastAndroid.LONG,
      ToastAndroid.CENTER
    );
    setCun(0)
  }


  return (
    <View>
      <View style={styles.Zhong}>
        <View style={{ marginLeft: 10, flexDirection: "row", }}>
          <Text>
            <Image
              source={require("../../assets/images/gengxin.png")}
              style={{ width: "20", height: "20", marginLeft: "10" }}
            ></Image>

          </Text>
          <Text style={{ justifyContent: "center" }}>
            <TouchableOpacity
              onPress={Toex}
            >
              <Text
              >  检查更新</Text>
            </TouchableOpacity>                                                           <Text>2.0</Text>   ></Text>
        </View>
      </View>
      <View style={styles.Zhong}>
        <View style={{ marginLeft: 10, flexDirection: "row", }}>
          <Text>
            <Image
              source={require("../../assets/images/ziliao.png")}
              style={{ width: "20", height: "20", marginLeft: "10" }}
            ></Image>

          </Text>
          <Text style={{ justifyContent: "center" }}>
            <TouchableOpacity
              onPress={Toex1}
            >
              <Text
              >  账号资料</Text>
            </TouchableOpacity>                                                                    ></Text>
        </View>
      </View>
      <View style={styles.Zhong}>
        <View style={{ marginLeft: 10, flexDirection: "row", }}>
          <Text>
            <Image
              source={require("../../assets/images/Password.png")}
              style={{ width: "20", height: "20", marginLeft: "10" }}
            ></Image>

          </Text>
          <Text style={{ justifyContent: "center" }}>
            <TouchableOpacity
              onPress={Toex2}
            >
              <Text
              >  修改密码</Text>
            </TouchableOpacity>                                                                    ></Text>
        </View>
      </View>
      <View style={styles.Zhong}>
        <View style={{ marginLeft: 10, flexDirection: "row", }}>
          <Text>
            <Image
              source={require("../../assets/images/qingli.png")}
              style={{ width: "20", height: "20", marginLeft: "10" }}
            ></Image>

          </Text>
          <TouchableOpacity
            onPress={Toecleax}
          >
            <Text style={{ justifyContent: "center" }}><Text>  清理缓存</Text>                                                           <Text><Text>{ cun }</Text>M</Text>   ></Text>
          </TouchableOpacity>
        </View>
      </View>
    </View>
  )
}

const styles = StyleSheet.create({
  Zhong: {
    height: 40,
    marginTop: 1,
    backgroundColor: "#ffffff",
    justifyContent: "center",
    width: "100%"
  },

})